option1 = {
  tooltip: {
    trigger: 'axis'
  },
  legend: {
    right:0,
    data: ['违规', '报警'],
  },
  grid: {
    left: 10,
    top:60,
    bottom:40,
    right:20,
    containLabel: true
  },
  toolbox: {
    show:false,
    feature: {
      saveAsImage: {}
    }
  },
  xAxis: {
    type: 'category',
    boundaryGap: false,//坐标轴两边留白
    data: ['09-01', '09-03', '09-04','09-05','09-06','09-07'],
    axisLabel: { //坐标轴刻度标签的相关设置。
      //	margin:15,
      textStyle: {
        color: '#999999',
        fontStyle: 'normal',
        fontSize: 14,
        padding:[10,0,0,0]
      },

      //rotate:50,
    },
    axisTick:{//坐标轴刻度相关设置。
      show: false,
    },
    axisLine:{//坐标轴轴线相关设置
      lineStyle:{
        color:'#949A9F',
        // opacity:0.2
      }
    },
    splitLine: { //坐标轴在 grid 区域中的分隔线。
      show: true,
      lineStyle: {
        color: '#E5E9ED',
        type:"dashed"
        // 	opacity:0.1
      }
    }
  },
  yAxis: [
    {
      type: 'value',
      splitNumber: 5,
      axisLabel: {
        textStyle: {
          color: '#a8aab0',
          fontStyle: 'normal',
          fontFamily: '微软雅黑',
          fontSize: 12,
        }
      },
      axisLine:{
        show: false
      },
      axisTick:{
        show: false
      },
      splitLine: {
        show: true,
        lineStyle: {
          color: '#E5E9ED',
          type:"dashed"
          // 	opacity:0.1
        }
      }

    }
  ],
  series: [
    {
      name: '违规',
      type: 'line',
      smooth:true,
      itemStyle: {
        normal: {
          color:'#3A84FF',
          lineStyle: {
            color: "#3A84FF",
            width:1
          },
          areaStyle: {
            color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
              offset: 0,
              color: '#FFFFFF'
            }, {
              offset: 1,
              color: '#8EAAEC'
            }]),
          }
        }
      },
      data: [ 37.5, 12, 18, 15, 16, 23.5, 22.5]
    },
    {
      name: '报警',
      type: 'line',
      smooth:true,
      itemStyle: {
        normal: {
          color:'rgba(255,80,124,1)',
          lineStyle: {
            color: "rgba(255,80,124,1)",
            width:1
          },
          areaStyle: {
            color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
              offset: 0,
              color: '#FFFFFF'
            }, {
              offset: 1,
              color: '#FFC5A7'
            }]),
          }
        }
      },
      data: [20, 14,10,9,24,17]
    }
  ]
};
var myChart1 = echarts.init(document.getElementById('charts1'));
myChart1.setOption(option1);

option2 = {
  radar: [{
    indicator: [{
      name: '设备离线',
      max: 125
    }, {
      name: '企\n业\n违\n规',
      max: 125,
      axisLabel: {
        show: false
      }
    }, {
      name: '车辆违规',
      max: 125,
      axisLabel: {
        show: false
      }
    }, {
      name: '路线偏离',
      max: 125,
      axisLabel: {
        show: false
      }
    }, {
      name: '车\n俩\n超\n速',
      max: 125,
      axisLabel: {
        show: false
      }
    }],
    center: ['24%', '55%'],
    radius: '50%',
    // startAngle: 90,
    splitNumber: 5,
    shape: 'polygon',
    triggerEvent: true,
    silent: true,
    scale: true,
    // nameGap:2,
    name: {
      formatter: '{value}',
      textStyle: {
        color: '#999999',
        fontSize: 14
      }
    },
    splitArea: {
      show: false
    },
    axisLine: {
      lineStyle: {
        color: '#DDDEDF'
      }
    },
    axisTick: {
      show: false
    },
    axisLabel: {
      show: false,
      color: '#DDDEDF'
    },
    splitLine: {
      lineStyle: {
        color: '#DDDEDF'
      }
    }
  }],
  series: [{
    name: '雷达图',
    type: 'radar',
    areaStyle: {
      normal: {
        color: 'rgba(88, 148, 255, 0.28)'
      }
    },
    lineStyle: {
      normal: {
        color: '#176BFF',
        width: 1
      }
    },
    data: [{
      value: [13, 3, 1, 12, 121],
      symbolSize: 0,
    }]
  }]
};
var myChart2 = echarts.init(document.getElementById('charts2'));
myChart2.setOption(option2);

option3 = {
  title:{
    text:"今日违规报警总量",
    top:20,
    left:60,
    itemGap:120,
    textStyle:{
      fontSize:16,
    },
    subtext:'{a|200}\n{b|违规报警（条）}',
    textAlign:"center",
    subtextStyle:{
      rich: {
        a:{
          fontSize:30,
          color:"#000000",
          padding:[10,0,0,95]
        },
        b:{
          fontSize:14,
          color:"#999999",
          padding:[0,0,0,110]
        }
      },
    }
  },
  legend: {
    data: [ '违规', '报警'],
    right:20,
    top:10,
    icon:"circle",
    textStyle: {
      color: "#333333",
      fontSize:14,
      padding:[1,0,0,0]
    },
    itemWidth: 14,
    itemHeight: 14,
    itemGap: 30
  },
  series: [
    {
      type: 'pie',
      radius: ['65%', '48%'],
      center:['24%','58%'],
      color:'#FF4500',
      hoverAnimation:false,
      label:{
        show:false
      },
      data: [ {
        name:"报警",
        value: 40,
        itemStyle: {
          normal: {
            color: '#FF591D'
          }
        },

      }, {
        value: 60,
        name:"违规",
        itemStyle: {
          normal: {
            color: '#176BFF'
          }
        },
      }]
    }
  ]
};
var myChart3 = echarts.init(document.getElementById('charts3'));
myChart3.setOption(option3);

if($('#charts4').length>0){
  option4 = {
    title:{
      text:"今日违规报警分布",
      top:20,
      left:60,
      textStyle:{
        fontSize:16,
      }
    },
    legend: {
      data: [ '违规', '报警'],
      right:20,
      top:10,
      icon:"circle",
      textStyle: {
        color: "#333333",
        fontSize:14,
        padding:[1,0,0,0]
      },
      itemWidth: 14,
      itemHeight: 14,
      itemGap: 30
    },
    tooltip: {
      show: "true",
      trigger: 'item',
      backgroundColor: 'rgba(0,0,0,0.7)', // 背景
      padding: [8, 10], //内边距
      extraCssText: 'box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);', //添加阴影
    },
    grid: {
      borderWidth: 0,
      left:90,
      right:10,
      top: 70,
      bottom: 50,
      textStyle: {
        color: "#fff"
      }
    },
    xAxis: {
      type: 'category',
      axisTick: {
        show: false
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: '#C1C1C1',
        }
      },
      axisLabel: {
        inside: false,
        textStyle: {
          color: '#999999',
          fontSize: '12',
          padding: [8,0,0,0]
        },
        // formatter:function(val){
        //     return val.split("").join("\n")
        // },
      },
      data: ['蜀山区','政务区','高新区','经开区','新站区','瑶海区','庐阳区','包河区','滨湖区','巢湖区','肥西县','肥东县','长丰县','庐江县'],
    },
    yAxis: {
      type: 'value',
      axisTick: {
        show: false
      },
      axisLine: {
        show: false,
      },
      splitLine: { //坐标轴在 grid 区域中的分隔线。
        show: true,
        lineStyle: {
          color: '#E5E9ED',
          type:"dashed"
          // 	opacity:0.1
        }
      },
      axisLabel: {
        show: true,
        textStyle: {
          color: "#999999",
          fontWeight: 'normal',
          fontSize: '12',
        }
      },
    },
    series: [{
      name: '违规',
      type: 'bar',
      itemStyle: {
        normal: {
          show: true,
          color: '#176BFF',
          borderWidth: 0,
          barBorderRadius:20
        },
        emphasis: {
          shadowBlur: 15,
          shadowColor: 'rgba(105,123, 214, 0.7)'
        }
      },
      barWidth: 10,
      data: [35,10,45,38,10,5,25,10,5,45,15,10,33,23],
    },{
      name: '报警',
      type: 'bar',
      itemStyle: {
        normal: {
          show: true,
          color: '#FF591D',
          borderWidth: 0,
          barBorderRadius:20
        },
        emphasis: {
          shadowBlur: 15,
          shadowColor: 'rgba(105,123, 214, 0.7)'
        }
      },
      barWidth: 10,
      data: [20,15,30,5,15,25,21,15,25,35,25,28,40,28],
    },

    ]
  }
  var myChart4 = echarts.init(document.getElementById('charts4'));
  myChart4.setOption(option4);
}

if($('#charts5').length>0){
  option5 = {
    title:{
      text:"今日违规报警企业TOP10",
      top:20,
      left:60,
      textStyle:{
        fontSize:16,
      }
    },
    legend: {
      data: [ '违规', '报警'],
      right:20,
      top:10,
      icon:"circle",
      textStyle: {
        color: "#333333",
        fontSize:14,
        padding:[1,0,0,0]
      },
      itemWidth: 14,
      itemHeight: 14,
      itemGap: 30
    },
    tooltip: {
      show: "true",
      trigger: 'item',
      backgroundColor: 'rgba(0,0,0,0.7)', // 背景
      padding: [8, 10], //内边距
      extraCssText: 'box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);', //添加阴影
    },
    grid: {
      borderWidth: 0,
      left:90,
      right:10,
      top: 70,
      bottom: 50,
      textStyle: {
        color: "#fff"
      }
    },
    xAxis: {
      type: 'category',
      axisTick: {
        show: false
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: '#C1C1C1',
        }
      },
      axisLabel: {
        inside: false,
        textStyle: {
          color: '#999999',
          fontSize: '12',
          padding: [8,0,0,0]
        },
        // formatter:function(val){
        //     return val.split("").join("\n")
        // },
      },
      data: ['蜀山区','政务区','高新区','经开区','新站区','瑶海区','庐阳区','包河区','滨湖区','巢湖区','肥西县','肥东县','长丰县','庐江县'],
    },
    yAxis: {
      type: 'value',
      axisTick: {
        show: false
      },
      axisLine: {
        show: false,
      },
      splitLine: { //坐标轴在 grid 区域中的分隔线。
        show: true,
        lineStyle: {
          color: '#E5E9ED',
          type:"dashed"
          // 	opacity:0.1
        }
      },
      axisLabel: {
        show: true,
        textStyle: {
          color: "#999999",
          fontWeight: 'normal',
          fontSize: '12',
        }
      },
    },
    series: [{
      name: '违规',
      type: 'bar',
      itemStyle: {
        normal: {
          show: true,
          color: '#176BFF',
          borderWidth: 0,
          barBorderRadius:[0,0,20,20]
        },
        emphasis: {
          shadowBlur: 15,
          shadowColor: 'rgba(105,123, 214, 0.7)'
        }
      },
      barWidth: 10,
      data: [35,10,45,38,10,5,25,10,5,45,15,10,33,23],
      stack: 1
    },{
      name: '报警',
      type: 'bar',
      itemStyle: {
        normal: {
          show: true,
          color: '#FF591D',
          borderWidth: 0,
          barBorderRadius:[20,20,0,0]
        },
        emphasis: {
          shadowBlur: 15,
          shadowColor: 'rgba(105,123, 214, 0.7)'
        }
      },
      barGap:"-100%",
      barWidth: 10,
      data: [20,15,30,5,15,25,21,15,25,35,25,28,40,28],
      stack: 1
    },

    ]
  };
  var myChart5 = echarts.init(document.getElementById('charts5'));
  myChart5.setOption(option5);
}

function showLeftTime()

{
  var now=new Date();
  var year=now.getFullYear();
  var month=now.getMonth()+1;
  if(month<10){
    month='0'+month;
  }
  var day=now.getDate();
  if(day<10){
    day='0'+day;
  }
  var hours=now.getHours();
  if(hours<10){
    hours='0'+hours;
  }
  var minutes=now.getMinutes();
  if(minutes<10){
    minutes='0'+minutes;
  }
  var seconds=now.getSeconds();
  if(seconds<10){
    seconds='0'+seconds;
  }
  var showTime=hours+":"+minutes+":"+seconds+"";

  var showData = year+"-"+month+"-"+day;
  $('#nowTime').html(showTime);

  $('#nowData').html(showData);
//一秒刷新一次显示时间
  var timeID=setTimeout(showLeftTime,1000);
}
